package com.google.code.virtualhockey.vhx.client.vp;

import com.google.code.virtualhockey.vhx.client.VhxEventBus;
import com.google.gwt.event.logical.shared.SelectionEvent;
import com.google.gwt.event.logical.shared.SelectionHandler;
import com.google.gwt.user.client.Window;
import com.mvp4g.client.annotation.Presenter;
import com.mvp4g.client.presenter.BasePresenter;

/** Presenter for the MenuView. */
@Presenter( view = MenuView.class )
public class MenuPresenter extends BasePresenter<MenuView, VhxEventBus> {

  public void onStart(){
    // does nothing, here to force view instantiation before injection into other UI parts
  }

  @Override
  public void bind() {
    // react when a different stack is selected
    // TODO do something more sensible when the selection is changed
    //
    getView().m_stackPanel.addSelectionHandler( new SelectionHandler<Integer>() {
      @Override
      public void onSelection( SelectionEvent<Integer> integerSelectionEvent ) {
        Window.alert( "Selected stack: " + integerSelectionEvent.getSelectedItem() );
      }
    } );
  }
}
